<template>
  <span
    @click="
      check = !check;
      $emit('input', check);
      $emit('change', check);
    "
  >
    <span
      v-if="check"
      class="iconfont icon-duigouxiao"
      :style="{ color: color, fontSize: size }"
    ></span>
    <span
      v-else
      class="iconfont icon-checkboxweixuanzhongda"
      :style="{ color: color, fontSize: size }"
    ></span>
    <slot></slot>
  </span>
</template>
<script>
export default {
  props: {
    size: {
      type: [ String, Number ],
      default: "14px",
    },
    color: {
      type: String,
      default: "#f70",
    },
    value: {
      type: [Boolean, Number],
      default: true,
    },
  },
  data(){
    return{
        check:this.value,
    }
  },
  watch:{
    "value":{
      handler(){
        this.check=this.value
      }
    }
  }
};
</script>
